package com.tbit.uqbike.object.view.sugar;

import com.tbit.uqbike.object.pojo.TerAlarm;
import com.tbit.utils.DateUtil;

import java.util.ArrayList;
import java.util.List;

/**
 * @author MyWin E-mail:335918956@qq.com
 * @version 1.0
 * @createTime 2020-02-06 15:44
 */
public class SugarAlarmInfo extends SugarTableItem {
    public static final String PRO_MNO = "mno";
    public static final String PRO_DT = "dt";
    public static final String PRO_ALARM_TYPE = "alarmType";
    public static List<SugarTableData.Columns> COLS;

    static {
        COLS = new ArrayList() {
            {
                add(new SugarTableData.Columns(PRO_MNO, PRO_MNO));
                add(new SugarTableData.Columns(PRO_DT, PRO_DT));
                add(new SugarTableData.Columns(PRO_ALARM_TYPE, PRO_ALARM_TYPE));
            }
        };
    }

    public String mno;
    public String dt;
    public String alarmType;

    public SugarAlarmInfo(TerAlarm ta) {
        this.mno = ta.getMachineNO();
        this.dt = DateUtil.MDHMS_.format(ta.getDt());
        this.alarmType = String.format("alarm.%d", ta.getAlarmType());
    }

    public void asterisk() {
        this.mno = AsteriskUtils.handle(this.mno, 2, 3);
    }
}
